package com.chenfan.mcn.model.vo;

import com.chenfan.mcn.constant.NumberCst;
import lombok.AllArgsConstructor;
import lombok.Data;
import org.apache.commons.collections4.CollectionUtils;

import java.io.Serializable;
import java.util.ArrayList;
import java.util.List;

/**
 * 批量确认打款结果VO
 *
 * @author wulg
 * @date 2022-07-13
 **/
@Data
public class BatchConfirmPaidResultVO implements Serializable  {

    private static final long serialVersionUID = -2034840306056987775L;

    /**
     * 成功数
     */
    private Integer successNum;

    /**
     * 失败数
     */
    private Integer failNum;

    /**
     * 失败信息-集合
     */
    private List<FailResult> failResultList;

    public BatchConfirmPaidResultVO() {
        this.successNum = NumberCst.ZERO;
        this.failNum = NumberCst.ZERO;
        this.failResultList = new ArrayList<>(8);
    }

    /**
     *
     * @param executeCode
     * @param failReason
     */
    public void addFailResult(String executeCode, String failReason){
        failResultList.add(new FailResult(executeCode, failReason));
        this.setFailNum(this.getFailNum().intValue() + 1);
    }

    /**
     * 失败结果明细
     */
    @AllArgsConstructor
    @Data
    public static class FailResult {

        /**
         * 执行单编号
         */
        private String executeCode;

        /**
         * 失败原因
         */
        private String failReason;
    }

}
